home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.earthlink.net!usenet
- From: brunop@earthlink.net (Peter Bruno)
- Newsgroups: comp.lang.c
- Subject: Q: Newbie using text files
- Date: Thu, 18 Apr 1996 20:04:46 GMT
- Organization: Earthlink Network, Inc.
- Message-ID: <4l6aqu$rfr@chile.it.earthlink.net>
- NNTP-Posting-Host: pool026.max12.new-york.ny.dynip.alter.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- I'm new to C programming so bear with me for a bit...
-
- I do a lot of small programming projects at work, mostly to make my
- life easier, and I've been using QBasic. I would like, however, to
- use a betting langauage if I could. But, trying to input and
- processes text files in C seems a lot harder than in C, what with
- pointers and all.
-
- My point, and I do have one, is it worth my time to learn C to process
- ASCII text files with fixed lenth fields, for sorting etc...
-
- and could you suggest some routines for doing this... in basic I just
- do the following:
-
- open "foo.bar" for input as #1
- open "foo.out" for output as #2
- while not eof(1)
- line input #1, row
- FName = mid$(row, 1, 25) 'characters 1-25 are first name
- LName = mid$(row, 26, 50)
- test = mid$(LName, 26, 1)
- if test < "M" then print #2, row 'if person's last name begins with
- character less then M print to output file, else we don't want them!
- wend
- close #1, #2
-
- can someone (kind-hearted and forgiving of stupid questions) please
- offer suggestions on how to do this in C? PLEASE!
-
- thanks,
-
- Peter Bruno
- brunop@earthlink.net
-
-
-